package the.formula.calculator;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;


public class Area extends Activity{
        
    private double answer = 0;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.two_dimensional_shapes);
    }
        
    public void onClick(View v) {
        Intent i = null;
        switch(v.getId()) {
        	case R.id.square:
        		break;
        	case R.id.rectangle:
        		break;
        	case R.id.circle:
        		break;
        	case R.id.triangle:
        		break;
        	case R.id.triangleSAS:
        		break;
        	case R.id.parallelogram:
        		break;
        	case R.id.trapezoid:
        		break;
        }
        if(i != null) {
            startActivity(i);
        }
    }
        
/****           Area formulas                   ****/
        
    private void squareArea(double x) {
        double result = x * x;
        answer = result;
    }
    
    private void rectangleArea(double length, double width) {
        double result = length * width;
        answer = result;
    }
    
    private void parallelogramArea(double length, double height) {
        double result = length * height;
        answer = result;
    }
    
    private void trapezoidArea(double base1, double base2, double height) {
        double result = (height / 2) * (base1 + base2);
        answer = result;
    }
    
    private void circleArea(double radius) {
        double result = Math.PI * (radius * radius);
        answer = result;
    }
    
    private void triangleArea(double base, double height) {
        double result = base * height / 2;
        answer = result;
    }
    
    private void triangleSasArea(double side1, double side2, double angle) {
        double result = side1 * side2 * Math.sin(angle) / 2;
        answer = result;
    }
}
